package com.atguigu.gulimall.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 26394
 */
@Configuration
public class MyRedissonConfig {
    /**
     * 所有对Redisson的使用都是通过RedissonClient对象
     * @return
     * @throws Exception
     */
    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson() throws Exception{
        Config config = new Config();
        //config.useClusterServers().addNodeAddress("127.0.0.1:7001","127.0.0.1:7002");
        config.useSingleServer().setAddress("127.0.0.1:7001");
        return Redisson.create(config);
    }
}
